package org.dandsoft.blackbox.laboratory.tests;

import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.BufferedOutputStream;
import java.io.DataOutputStream;

/**
 * @author Vilyuzhanin Denis (Fin)
 */
public class FullCombinationSpeed {

    public static void main(String[] args) throws Exception {
        final int SIZE = 10000;
        int totalCount = 0;
        OutputStream out = new BufferedOutputStream(new FileOutputStream("e:/test"), 10 * 1024);
        byte[][] counters = new byte[SIZE][SIZE];
        DataOutputStream dataOut = new DataOutputStream(out);
        try {
            long t1 = System.currentTimeMillis();
            for (int i = 0; i < SIZE; i++) {
                for (int j = i; j < SIZE; j++) {
                    //dataOut.writeInt(i);
                    //dataOut.writeInt(j);
                    counters[i][j]++;
                    totalCount++;
                }
            }
            long t2 = System.currentTimeMillis();
            System.out.println("Duration: " + (t2 - t1));
            System.out.println("Total count: " + totalCount);
            System.out.println("Speed: " + ((SIZE * SIZE) / (double) (t2 - t1)));
        } finally {
            out.close();
        }


    }
}
